import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import json from 'rollup-plugin-json'

export default [
  {
    // browser-friend UMD build
    input: 'src/index.js',
    output: {
      name: 'ShpConverter',
      file: 'dist/shpconverter.umd.js',
      format: 'umd',
    },
    plugins: [
      resolve(),
      commonjs(),
      json(),
    ]
  },
  // CommonJS (for Node) and ES module (for bundlers) build.
  {
    input: 'src/index.js',
    external: [
      'd3-dsv',
      'flatbush',
      'iconv-lite',
      'jszip',
      'mproj'
    ],
    output: [
      { 
        file: 'dist/shpconverter.cjs.js',
         format: 'cjs' 
      },
      { 
        file: 'dist/shpconverter.esm.js', 
        format: 'es'
      }
    ],
    plugins: [
      resolve(),
      commonjs(),
      json(),
    ]
  }
]